import { apiClient } from 'axiom-view';

/**
 * 获取客户端列表（分页）
 * @param {object} params - 查询参数，例如 { page, page_size, client_name }
 * @returns {Promise<any>}
 */
export const getClientList = (params) => {
  return apiClient.get('/system/clients', { params });
};

/**
 * 获取客户端详情
 * @param {string} clientId - 客户端ID
 * @returns {Promise<any>}
 */
export const retrieveClientDetails = (clientId) => {
  return apiClient.get(`/system/clients/${clientId}`);
};

/**
 * 新增客户端
 * @param {object} data - 客户端数据 (ClientCreateDTO)
 * @returns {Promise<any>}
 */
export const createClient = (data) => {
  return apiClient.post('/system/clients', data);
};

/**
 * 修改客户端信息
 * @param {string} clientId - 客户端ID
 * @param {object} data - 要更新的客户端数据 (ClientUpdateDTO)
 * @returns {Promise<any>}
 */
export const updateClient = (clientId, data) => {
  return apiClient.put(`/system/clients/${clientId}`, data);
};

/**
 * 删除客户端
 * @param {string} clientId - 客户端ID
 * @returns {Promise<any>}
 */
export const deleteClient = (clientId) => {
  return apiClient.delete(`/system/clients/${clientId}`);
};

/**
 * 启用客户端
 * @param {string} clientId - 客户端ID
 * @returns {Promise<any>}
 */
export const enableClient = (clientId) => {
  return apiClient.put(`/system/clients/${clientId}/enable`);
};

/**
 * 禁用客户端
 * @param {string} clientId - 客户端ID
 * @returns {Promise<any>}
 */
export const disableClient = (clientId) => {
  return apiClient.put(`/system/clients/${clientId}/disable`);
};

/**
 * 批量删除客户端
 * @param {string[]} clientIds - 客户端ID列表
 * @returns {Promise<any>}
 */
export const batchDeleteClients = (clientIds) => {
  return apiClient.delete('/system/clients', { data: { ids: clientIds } });
}; 